#ifndef __GAUGE_HPP__
#define __GAUGE_HPP__

#include <atomic>

#include "metrics/MetricType.hpp"
#include "metrics/ClientMetric.hpp"

namespace metrics
{
    class Gauge
    {
    private:
        std::atomic<double> _value{0};

    public:
        static const MetricType METRIC_TYPE{MetricType::Gauge};

        Gauge(double v = 0);
        ~Gauge();

        void increment(double v = 1);
        void decrement(double v = 1);
        void set(double);
        void set_current_time();
        double value() const;
        ClientMetric collect() const;

    private:
        void change(double v);
    };

} // namespace metrics

#endif // __GAUGE_HPP__